package UI
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	import UI.Button;
	import UI.Page;
	
	/**
	 * ...
	 * @author Bryan Keiren & Sander van Katwijk
	 */
	public class Menu 
	{		
		private var m_Pages:Vector.<Page> = new Vector.<Page>();
		
		public function Menu():void
		{
			
		}
		
		public function addPage(a_Page:Page):void
		{
			if (m_Pages.length >= 1)
			{
				a_Page.disable();
			}
			m_Pages.push(a_Page);
		}
		
		public function setPage(a_Index:int):void
		{
			if (a_Index >= m_Pages.length || a_Index < 0)
			{
				return;
				trace("Page index out of range. (" + a_Index + " to max of " + (m_Pages.length - 1) + ")");
			}
			
			for (var i:int = 0; i < m_Pages.length; ++i)
			{
				if (i == a_Index)
				{
					m_Pages[i].enable();
				}
				else
				{
					m_Pages[i].disable();
				}
			}
		}
		
		public function getPage(a_Index:int):Page
		{
			if (a_Index >= m_Pages.length || a_Index < 0)
			{
				trace("Page index out of range. (" + a_Index + " to max of " + (m_Pages.length - 1) + ")");
				return null;
			}
			
			return m_Pages[a_Index];
		}
		
		public function disable():void
		{
			for (var i:int = 0; i < m_Pages.length; ++i)
			{
				m_Pages[i].disable();
			}
		}
		
		public function enable():void
		{
			for (var i:int = 0; i < m_Pages.length; ++i)
			{
				m_Pages[i].enable();
			}
		}		
	}

}